<template>
	<view class="homePage">
		<uni-mdnav title="个人主页"></uni-mdnav>
		<view class="bg">
			<image src="https://aihelp.oss-cn-hangzhou.aliyuncs.com/kwkd/resources/personal/defaultBg.jpg" mode=""></image>
		</view>
		<view class="homeMain">
			<view class="info font14">
				<!-- 个人信息 -->
				<view class="alignCenter flex justConBetween">
					<view class="flex alignCenter">
						<view class="avater">
							<image class="avaterImg"
								:src="userInfo.avatar || 'https://image.alhelp.net/uploads/20231104/4d491857ac50d21ebbcb25ff5bc254f8.png'"
								mode="widthFix"></image>
							<view class="playItem" @click="handleInfo(1)" v-if="infoFileUrl">
								<view class="flex alignCenter">
									<!-- <image class="playPng" v-if="isPlay" src="../static/play.png" mode="widthFix"></image> -->
									<!-- <image class="pausePng" @click.stop="handleSuspend" v-else src="../static/pause.png" mode="widthFix"></image> -->
									<uni-icons type="headphones" color="#A95592" size="16"
										style="line-height: 40rpx;margin-left: 16rpx;"></uni-icons>
									<image class="waveGif" v-if="isPlay" src="../static/waveGif.png" mode="widthFix"></image>
									<image class="waveGif" v-else src="../static/waveGif.gif" mode="widthFix" @click.stop="handleSuspend">
									</image>
								</view>
							</view>
							<image src="../static/videos.png" class="videoUrls" mode="widthFix" @click="handleInfo(2)"
								v-if="infoVideoUrl"></image>
						</view>
						<view class="">
							<view class="">
								<view class="bold font16 nickName flex alignCenter" style="margin-top: 30rpx;">
									{{userInfo.nickName || '匿名用户'}}
									<image v-if="infoImgUrl" src="/static/image/icons/pic.png" mode="widthFix" class="mathMagrin"
										@click="handleInfo(3)"></image>
								</view>
								<view class="font14 color999 fan flex alignCenter" v-if="userInfo">
									<view @click="handleClick('fan')"><text
											class="colorMain">{{userInfo.fansFollowers.followersTotal}}</text>粉丝</view>
									<view @click="handleClick('focus')"><text
											class="colorMain">{{userInfo.fansFollowers.friendsTotal}}</text>关注</view>
								</view>
							</view>
						</view>
					</view>
					<view class="noWidthBtn font14" v-if="!isMine" @click.stop="focusClick">{{userInfo.isLikedUser?'取消关注':'+关注'}}
					</view>
				</view>
				<view class="font14 color666 intro">{{userInfo.introduction || '这个人很懒，还什么都没有写~'}}</view>
				<view class="edu">
					<view class="flex alignCenter">
						<view class="bold font14">教育信息：</view>
						<view v-if="!isAuthor && educationList.length<=0" class="noWidthBtn font14 info-btn"
							@click="handleUnlock(1)">解锁</view>
						<view v-if="isAuthor && educationList.length==0" class="noWidthBtn font14 info-btn"
							@click="handleUnlock(1)">完善教育信息</view>
					</view>
					<view class="education-list" v-if="isAuthor || (!isAuthor && educationList.length>=0)">
						<view class="item font12 color333" v-for="(val,i) in educationList"> {{val.schoolName}} | {{val.majorName}}
							| {{val.graduationYear}}级（{{val.diploma==1?'本科':val.diploma==2?'研究生':'博士'}}）</view>
					</view>
				</view>
				<view class="job">
					<view class="flex alignCenter">
						<view class="bold font14">职业信息：</view>
						<view v-if="!isAuthor && jobList.length<=0" class="noWidthBtn font14 info-btn" @click="handleUnlock(2)">解锁
						</view>
						<view v-if="isAuthor && jobList.length==0" class="noWidthBtn font14 info-btn" @click="handleUnlock(2)">
							完善职业信息</view>
					</view>
					<view class="job-list" v-if="isAuthor || (!isAuthor && jobList.length>=0)">
						<view class="item font12 color333" v-for="(val,i) in jobList"> {{val.companyName}} | {{val.position}} |
							{{val.startTime+'年~'+val.endTime+'年'}}
						</view>
					</view>
				</view>
			</view>
			<view class="tabModule">
				<uni-tabchange :tabArr="tabArr" :activeTab="activeTab" :isFixed="false"
					@tabChangeSuccess="tabChangeSuccess"></uni-tabchange>
			</view>
			<!-- 问答 -->
			<view class="quesModule" v-if="activeTab==0">
				<template v-for="(item,index) in listData">
					<view class="queOne">
						<uni-question :quesItem="item" :key="index" :canFocus="false"></uni-question>
					</view>
				</template>
			</view>
			<!-- 笔记 -->
			<view class="quesModule" v-if="activeTab==1">
				<template v-for="(item,index) in listData">
					<view class="queOne" :key="index">
						<uni-question :quesItem="item" :canFocus="false"></uni-question>
					</view>
				</template>
			</view>
			<!-- 小组 -->
			<view class="groupList flex justConBetween" v-if="activeTab==2">
				<view class="leftBox">
					<template v-for="(item,index) in listData">
						<view class="groupOne" :key="index" v-if="index%2==0">
							<uni-mygroup :groupItem="item" :canAdd="item.loginTeamUserVO.userState>1"
								:canActivity="userId==item.createUserId"></uni-mygroup>
						</view>
					</template>
				</view>
				<view class="rightBox" v-if="activeTab==2">
					<template v-for="(item,index) in listData">
						<view class="groupOne" :key="index" v-if="index%2!=0">
							<uni-mygroup :groupItem="item" :canAdd="item.loginTeamUserVO.userState>1"
								:canActivity="userId==item.createUserId"></uni-mygroup>
						</view>
					</template>
				</view>
			</view>

			<!-- 群 -->
			<view class="groupList flex justConBetween" v-if="activeTab==3">
				<view class="leftBox">
					<template v-for="(item,index) in listData">
						<view class="groupOne" :key="index" v-if="index%2==0">
							<view class="groupItem">
								<view class="groupBg">
									<view class="cover">
										<image :src="item.codeUrl" mode="widthFix"></image>
									</view>
									<view class="bgMain flex alignCenter">
										<view class="flex alignCenter justConBetween smallOper">
											<image src="@/static/image/icons/scan.png" mode="widthFix" @click.stop="showScan(item.codeUrl)">
											</image>
											<!-- <i class="iconfont icon-lajitong delete" @click.stop="operQQ('del',item)"></i> -->
											<uni-icons v-if="item.createUserId == authorId" type="trash" color="#fff" size="18"
												@click="operQQ('del',item)"></uni-icons>
										</view>
										<view class="oper font12 colorMain" v-if="item.createUserId == authorId">
											<view @click.stop="operQQ('edit',item)"><i class="iconfont icon-bianji focusMargin"></i>编辑</view>
										</view>
										<view class="qqNum" @click.stop="copyClick(item.userGroupNo)">
											<text class="font14 bold focusMargin">{{item.userGroupNo}}</text>
											<image src="@/static/image/icons/copy.png" mode="widthFix"></image>
										</view>
									</view>
								</view>
								<view class="con font14">
									<view class="title hiddenOneline">{{item.userGroupName}}</view>
									<!-- <view class="qqNum hiddenOneline">{{item.userGroupNo}}</view> -->
									<view class="qqIntro font12 color666 hiddenOneline">{{item.userGroupIntroduction}}</view>
									<view class="tag colorBlue font12 flex alignCenter flexWrap">
										<text>{{item.schoolName}}</text>
										<text>{{item.majorName}}</text>
									</view>
								</view>
							</view>
						</view>
					</template>
				</view>
				<view class="rightBox">
					<template v-for="(item,index) in listData">
						<view class="groupOne" :key="index" v-if="index%2!=0">
							<view class="groupItem">
								<view class="groupBg">
									<view class="cover">
										<image :src="item.codeUrl" mode="widthFix"></image>
									</view>
									<view class="bgMain flex alignCenter">
										<view class="flex alignCenter justConBetween smallOper">
											<image src="@/static/image/icons/scan.png" mode="widthFix" @click.stop="showScan(item.codeUrl)">
											</image>
											<!-- <i class="iconfont icon-lajitong delete" @click.stop="operQQ('del',item)"></i> -->
											<uni-icons type="trash" color="#fff" v-if="item.createUserId == authorId" size="18"
												@click="operQQ('del',item)"></uni-icons>
										</view>
										<view class="oper font12 colorMain" v-if="item.createUserId == authorId">
											<view @click.stop="operQQ('edit',item)"><i class="iconfont icon-bianji focusMargin"></i>编辑</view>
										</view>
										<view class="qqNum" @click.stop="copyClick(item.userGroupNo)">
											<text class="font14 bold focusMargin">{{item.userGroupNo}}</text>
											<image src="@/static/image/icons/copy.png" mode="widthFix"></image>
										</view>
									</view>
								</view>
								<view class="con font14">
									<view class="title hiddenOneline">{{item.userGroupName}}</view>
									<view class="tag colorBlue font12 flex alignCenter flexWrap">
										<text>{{item.schoolName}}</text>
										<text>{{item.majorName}}</text>
									</view>
								</view>
							</view>
						</view>
					</template>
				</view>
			</view>

			<!-- 接力找人 -->
			<view class="groupList justConBetween lookForBox" v-if="activeTab==4">
				<template v-for="(item,index) in listData">
					<view class="peopleOne" :key="index" @click="handleLookForItem(item)">
						<view class="info font14">
							<view class="flex alignCenter">
								<!-- <view class="avater"> -->
								<image
									:src="item.createUserAvatar || 'https://image.alhelp.net/uploads/20231104/4d491857ac50d21ebbcb25ff5bc254f8.png'"
									mode="widthFix"></image>
								<!-- foundPersonType  找人类型枚举 1、 我找人，2、委托我，3、我接力，4、我揭榜-->
								<!-- </view> -->
								<view class="flex alignCenter justConBetween infoName">
									<view class="">
										<view class="bold font16 nickName">{{item.createUserName || '匿名用户'}}</view>
										<view class="font12 color999 foundPersonType">
											{{item.foundPersonType == 3?'接力找人':item.foundPersonType==4?'揭榜':item.foundPersonType==1?'发布找人':''}}
										</view>
									</view>
									<view class="flex alignCenter editBox">
										<view class="colorRed font14">￥{{item.bounty}}</view>
									</view>
								</view>
							</view>
							<view class="bold font13 color333 flex alignCenter justConBetween findTitle">
								<view class="hiddenOneline">{{item.title}}</view>
							</view>
							<view class="flex alignCenter colorBlue tag font12">
								<text>{{item.schoolName}}</text>
								<text>{{item.majorName}}</text>
							</view>
							<view class="flex alignCenter flexWrap operBtn otherBtn" v-if="item.createUserId != authorId">
								<view class="leftBtn font12 flex alignCenter" @click.stop="handleShare(item)">
									<image src="https://image.alhelp.net/uploads/20231104/db05a877babde8bbcce75893aced0760.png"
										mode="widthFix"></image> 接力找人
								</view>
								<view class="rightBtn font12 flex alignCenter" @click.stop="handleListClick(item)">
									<image src="/static/image/icons/target.png" mode="widthFix"></image> 揭榜
								</view>
							</view>
						</view>

					</view>
				</template>
			</view>

			<uni-nodata v-if="listData.length==0"></uni-nodata>

			<view class="btns flex alignCenter" v-if="isUnveiling">
				<view class="btn1 flex alignCenter" @click="handleUnveiling(false)">
					<view class="flex alignCenter"><uni-icons type="closeempty" color="#333" size="15"></uni-icons></view> 不是
				</view>
				<view class="btn2 flex alignCenter" @click="handleUnveiling(true)">是 <view class="flex alignCenter"><uni-icons
							type="checkmarkempty" color="#333" size="15"></uni-icons> </view>
				</view>
			</view>
		</view>
		<!-- 揭榜成功 -->
		<uni-succ v-if="showSuccessTip" @layerOper="layerOper"></uni-succ>
		<u-popup mode="center" v-model="tipPopup" :mask-close-able="false">
			<view class="tipPopup" v-if="unveilingTxt">
				<view class="tips flex alignCenter">
					<image
						:src="userInfo.avatar || 'https://image.alhelp.net/uploads/20231104/4d491857ac50d21ebbcb25ff5bc254f8.png'"
						mode="widthFix"></image>
					<view class="font12">请在<text class="font14 colorRed">24</text>小时内确认揭榜者，否则系统会默认Ta就是你要找的人。您的<text
							class="font14 colorRed">赏金</text>会将会给到接力找人团。</view>
				</view>
				<view class="know-btn font14 color333" @click="handleKnow">知道了</view>
			</view>
			<view class="unveilingPopup" v-else>
				<view class="tips">
					<image src="/static/image/icons/attestation.png" mode="widthFix"></image>
					<view class="font16">你的赏金已经成功支付给了接力团！</view>
				</view>
			</view>
		</u-popup>

		<!-- 找人按钮 -->
		<view class="findBtn" v-if="userInfo.userId!=authorId">
			<view class="" @click="operClick(1)">
				<image src="@/static/image/floatBtn/q3.png" mode="widthFix"></image>
				<view class="font12">提问</view>
			</view>

			<view class="" @click="operClick(2)">
				<image src="@/static/image/setting/major.png" mode="widthFix"></image>
				<view class="font12">找人</view>
			</view>
		</view>


		<!-- 视频播放 -->
		<u-popup mode="center" v-model="videoPpoup">
			<view class="hasVideo">
				<video controls object-fit="cover" :src="infoVideoUrl"></video>
			</view>
		</u-popup>
		<!-- 找人 -->
		<entrustPeople :showEntrustPeople="showEntrustPeople" :seniorSisterId="seniorSisterId"
			:seniorSisterName="seniorSisterName" :seniorSisterAvatar="seniorSisterAvatar"
			@cancelEntrust="showEntrustPeople=false"></entrustPeople>
	</view>
</template>

<script>
	import {
		getUserInfo,
		homePageQues,
		myNote,
		homePageGroup,
		personalHome,
		educationList,
		jobList,
		myQQ
	} from "@/api/mine.js"
	import {
		relpayOper,
		askForEduInfo,
		answerFind,
		confirmUnveiled
	} from "@/api/lookFor.js"
	import {
		focusUser
	} from "@/api/index.js"
	import {
		delQQ
	} from "@/api/send.js"
	import uniSucc from "@/pages/mine/components/uni-succ/uni-succ.vue"
	import {
		previewImg
	} from "@/utils/common.js"
	import entrustPeople from "./entrustPeople/entrustPeople.vue"
	export default {
		components: {
			uniSucc,
			entrustPeople
		},
		data() {
			return {
				tipPopup:false,
				videoPpoup: false,
				authorId: '',
				activeTab: 0,
				unveilingTxt: false, //弹窗是否为揭榜说明提示语
				isUnveiling: false, //是否查看揭榜
				infoFileUrl: '', //音频链接
				infoVideoUrl: '', //视频链接
				infoImgUrl: '', //图片链接
				audioMusic: null, //音频播放
				isPlay: true, //音频是否播放
				findId: '', //找人id
				parentId: '', //父级id
				tabArr: [{
					title: '问答'
				}, {
					title: '笔记'
				}, {
					title: '小组'
				}, {
					title: '群'
				}, {
					title: '接力找人'
				}],
				listData: [],
				// noteData:[],
				userInfo: '',
				isMine: true,
				userId: '',
				page: 1,
				pageSize: 20,
				pageTotal: 0,
				showSuccessTip: false,
				isAuthor: true, //判断是否查看自己的主页
				educationList: [],
				jobList: [],
				// 找人需要的数据
				showEntrustPeople: false,
				seniorSisterId: '',
				seniorSisterName: '',
				seniorSisterAvatar: ''
			};
		},
		onLoad(option) {
			this.authorId = uni.getStorageSync('userId');
			this.userId = option.userId ? option.userId : uni.getStorageSync('userId');
			if (option.isUnveiling) {
				this.isUnveiling = option.isUnveiling;
				this.findId = option.findId;
				this.parentId = option.parentId;
				if (!uni.getStorageSync('unveilingTxt')) {
					uni.setStorageSync('unveilingTxt', true);
					this.unveilingTxt = true;
					this.$nextTick(() => {
						this.tipPopup = true;
					})
				}
			}
			// 判断是否是本人,本人则直接展示教育信息和职业信息,非本人则判断自己的信息是否完善,不完善就显示解锁,完善则显示相应信息
			if (this.userId != uni.getStorageSync('userId')) {
				this.isAuthor = false;
			}
			this.getUser();
			this.getTabData();
			this.getEducationList();
		},
		methods: {
			// 根据tab获取数据
			getTabData() {
				this.page = 1;
				this.listData = [];
				if (this.activeTab == 0) {
					this.getQuesList()
				} else if (this.activeTab == 1) {
					this.getNoteList()
				} else if (this.activeTab == 2) {
					this.getGroupList()
				} else if (this.activeTab == 3) {
					// 群
					this.getQQList();
				} else if (this.activeTab == 4) {
					// 接力找人
					this.getFindPeople();
				}
			},
			tabChangeSuccess(obj) {
				this.activeTab = obj.activeTab
				this.getTabData()
			},
			// 获取教育信息/职业信息
			getEducationList() {
				// 查询本人教育信息
				educationList({
					page: 1,
					size: 10,
					createUserId: uni.getStorageSync('userId')
				}).then(res => {
					if (res.code == 100000) {
						if (!this.isAuthor && res.data.rows.length > 0) {
							// 非本人,查询用户教育
							educationList({
								page: 1,
								size: 10,
								createUserId: this.userId
							}).then(res => {
								if (res.code == 100000) {
									this.educationList = res.data.rows;
									if (res.data.rows.length > 0) {
										for (let val of res.data.rows) {
											if (val.diploma == 2) {
												for (let item of val.fileUrls) {
													if (item.type == 'imgUrl') {
														this.infoImgUrl = item.url;
													}
													if (item.type == 'videoUrl') {
														this.infoVideoUrl = item.url;
													}
													if (item.type == 'fileUrl') {
														this.infoFileUrl = item.url;
													}
												}
											}
										}
									}
								}
							})
						} else {
							this.educationList = res.data.rows;
							if (res.data.rows.length > 0) {
								for (let val of res.data.rows) {
									if (val.diploma == 2) {
										for (let item of val.fileUrls) {
											if (item.type == 'imgUrl') {
												this.infoImgUrl = item.url;
											}
											if (item.type == 'videoUrl') {
												this.infoVideoUrl = item.url;
											}
											if (item.type == 'fileUrl') {
												this.infoFileUrl = item.url;
											}
										}
									}
								}
							}
						}

					}
				})
				// 查询本人职业信息
				jobList({
					page: 1,
					size: 10,
					userId: uni.getStorageSync('userId')
				}).then(res => {
					if (res.code == 100000) {
						if (!this.isAuthor && res.data.rows.length > 0) {
							// 非本人,查询用户职业
							jobList({
								page: 1,
								size: 10,
								userId: this.userId
							}).then(res => {
								if (res.code == 100000) {
									this.jobList = res.data.rows;
								}
							})
						} else {
							this.jobList = res.data.rows;
						}

					}
				})
			},

			// 基本信息查看 type 1、音频，2、视频，3、图片
			handleInfo(type) {
				if (type == 1) {
					//音频
					this.audioMusic = uni.createInnerAudioContext();
					this.audioMusic.autoplay = true;
					this.audioMusic.src = this.infoFileUrl;
					this.audioMusic.onPlay(() => {
						// 开始播放
						this.isPlay = false;
						console.log('开始播放');
					});
					this.audioMusic.onEnded(() => {
						//自然播放结束
						this.isPlay = true;
						this.audioMusic.destroy();
						this.audioMusic = null;
					});
					this.audioMusic.onError((res) => {
						this.isPlay = true;
					});
					return
				}
				if (type == 2) {
					//视频
					this.videoPpoup = true;
					return
				}
				if (type == 3) {
					//图片
					uni.previewImage({
						current: 0,
						urls: [this.infoImgUrl]
					});

					return
				}
			},
			// 播放暂停
			handleSuspend(e) {
				console.log('播放暂停', e)
				this.audioMusic.pause();
				this.isPlay = true;
				this.audioMusic.destroy();
				// this.audioMusic.onPause(() => {
				// 	this.isPlay = true;
				// 	this.audioMusic.destroy();
				// });
			},

			// 解锁 type 1、教育。2、职业
			handleUnlock(type) {
				if (type == 1) {
					uni.navigateTo({
						url: '/settingPages/pages/education/eduCardList/eduCardList'
					})
					return
				}
				uni.navigateTo({
					url: '/settingPages/pages/job/jobCardList/jobCardList'
				})

			},
			// 获取用户信息
			getUser() {
				getUserInfo({
					userId: this.userId
				}).then((res) => {
					if (res.code == 100000) {
						this.userInfo = res.data
						this.isMine = uni.getStorageSync('userId') == this.userInfo.userId
						this.tabArr[0].title = '问答' + this.userInfo.personalSummaryTotal.questionAnswerTotal
						this.tabArr[1].title = '笔记' + this.userInfo.personalSummaryTotal.notesTotal
						this.tabArr[2].title = '小组' + this.userInfo.personalSummaryTotal.teamTotal;
						this.tabArr[3].title = '群' + this.userInfo.personalSummaryTotal.userGroupTotal;
						this.tabArr[4].title = '接力找人' + this.userInfo.personalSummaryTotal.foundPersonRelayTotal;
					}
				})
			},
			// 粉丝/关注的点击事件
			handleClick(type) {
				if (type == 'fan') {
					uni.navigateTo({
						url: '/pages/mine/fan/fan?userId=' + this.userInfo.userId
					})
					return
				} else if (type == 'focus') {
					uni.navigateTo({
						url: '/pages/mine/focus/focus?userId=' + this.userInfo.userId
					})
					return
				}
			},
			// 关注
			focusClick() {
				if (this.userInfo.userId == uni.getStorageSync('userId')) {
					uni.showToast({
						title: '亲，这是你自己哦',
						icon: 'none'
					})
					return
				}
				if (this.userInfo.isLikedUser) {
					uni.showModal({
						title: '提示',
						content: '确定不再关注？',
						success: (res) => {
							if (res.confirm) {
								this.focusApi()
							} else if (res.cancel) {}
						}
					});
					return
				}
				this.focusApi()
			},
			focusApi() {
				let param = {
					isAdd: !this.userInfo.isLikedUser,
					fansUserId: this.userInfo.userId,
					fansUserName: this.userInfo.nickName,
					fansUserAvatar: this.userInfo.avatar,
				}
				focusUser(param).then((res) => {
					if (res.code == 100000) {
						this.getUser();
						this.userInfo.isLikedUser = !this.userInfo.isLikedUser;
					}
				})
			},
			// 问答列表
			getQuesList() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				let param = {
					page: this.page,
					size: this.pageSize,
					userId: this.userId
				}
				homePageQues(param).then((res) => {
					uni.hideLoading()
					if (res.code == 100000) {
						this.listData = this.listData.concat(res.data.rows)
						this.pageTotal = Math.ceil(res.data.total / this.pageSize)
						this.tabArr[0].title = '问答' + res.data.total
					}
				}).catch((err) => {
					uni.hideLoading()
				})
			},
			// 笔记列表
			getNoteList() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				let param = {
					page: this.page,
					size: this.pageSize,
					userId: this.userId
				}
				myNote(param).then((res) => {
					uni.hideLoading()
					if (res.code == 100000) {
						this.listData = this.listData.concat(res.data.rows)
						this.pageTotal = Math.ceil(res.data.total / this.pageSize)
						this.tabArr[1].title = '笔记' + res.data.total
					}
				}).catch((err) => {
					uni.hideLoading()
				})
			},
			// 小组
			getGroupList() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				let param = {
					page: this.page,
					size: this.pageSize,
					userId: this.userId
				}
				homePageGroup(param).then((res) => {
					uni.hideLoading()
					if (res.code == 100000) {
						this.listData = this.listData.concat(res.data.rows)
						this.pageTotal = Math.ceil(res.data.total / this.pageSize)
						this.tabArr[2].title = '小组' + res.data.total
					}
				}).catch((err) => {
					uni.hideLoading()
				})
			},

			// 群列表
			getQQList() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				let param = {
					page: this.page,
					size: this.pageSize,
					createUserId: this.userId
				}
				myQQ(param).then((res) => {
					uni.hideLoading()
					if (res.code == 100000) {
						this.listData = this.listData.concat(res.data.rows)
						this.pageTotal = Math.ceil(res.data.total / this.pageSize);
						this.tabArr[3].title = '群' + res.data.total
					}
				}).catch((err) => {
					uni.hideLoading()
				})
			},

			operQQ(type, item) {
				if (type == 'edit') {
					uni.navigateTo({
						url: '/settingPages/pages/qq/qq?id=' + item.id
					})
				} else {
					uni.showModal({
						title: '提示',
						content: '是否确定删除该群？',
						success: (res) => {
							if (res.confirm) {
								delQQ({
									id: item.id
								}).then((res2) => {
									if (res2.code == 100000) {
										this.initPage()
										this.getQQList()
									}
								})
							}
						}
					});
				}
			},
			copyClick(qq) {
				uni.setClipboardData({
					data: qq,
					showToast: false,
					success: () => {
						uni.showToast({
							title: '复制成功',
							icon: 'none'
						})
					}
				});
			},
			// 查看qq群二维码
			showScan(url) {
				previewImg([url], 0)
			},


			// 接力找人
			getFindPeople() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				let param = {
					page: this.page,
					size: this.pageSize,
					userId: this.userId,
					// foundPersonType: 3,//1、我找人，2、委托我，3、我接力，4、我揭榜
				}
				personalHome(param).then((res) => {
					uni.hideLoading()
					if (res.code == 100000) {
						this.listData = this.listData.concat(res.data.rows)
						this.pageTotal = Math.ceil(res.data.total / this.pageSize)
						this.tabArr[4].title = '接力找人' + res.data.total
					}
				}).catch((err) => {
					uni.hideLoading()
				})
			},

			// 分享/接力找人
			handleShare(item) {
				relpayOper({
					id: item.id
				}).then(res => {
					if (res.code == 100000) {
						let query = {
							id: item.id,
							inviteType: 6
						}
						uni.navigateTo({
							url: '/pages/school/share/share?query=' + JSON.stringify(query)
						})
					}
				})
			},
			// 揭榜
			handleListClick(item) {
				//判断信息是否完善
				askForEduInfo().then((res) => {
					if (res.code == 100000) {
						// 教育信息状态：-1、未通过，-2，待审核，0：未填写(未通过)；1:已通过（tag没写）；2：已通过:(fileUrls没写); 3已通过（tag没填和fileUrls没填）;4:已通过
						// 职业信息状态：0：未填写；1、未通过，2，待审核，4：已通过
						if (res.data.educationState == -1) {
							return uni.showModal({
								title: '提示',
								content: '您的教育信息未通过审核，是否前往修改？',
								success: function(res) {
									if (res.confirm) {
										uni.navigateTo({
											url: '/pages/send/lookFor/postgraduate/enrollment/education?backDelta=3'
										})
									}
								}
							});
						}
						if (res.data.educationState == -2) {
							return uni.showModal({
								title: '提示',
								content: '您的教育信息正在审核，通过后才能揭榜哦。',
								success: function(res) {
									if (res.confirm) {
										// uni.navigateTo({
										// 	url:'/pages/send/lookFor/postgraduate/enrollment/education?backDelta=3'
										// })
									}
								}
							});
						}
						if (res.data.educationState == 0) {
							return uni.showModal({
								title: '提示',
								content: '揭榜前需要完善您的相关信息，是否前往？',
								success: function(res) {
									if (res.confirm) {
										uni.navigateTo({
											url: '/pages/send/lookFor/postgraduate/enrollment/education?backDelta=3'
										})
									}
								}
							});
						}

						if (res.data.educationState == 1 || res.data.educationState == 3) {
							return uni.showModal({
								title: '提示',
								content: '揭榜前需要完善您的个人优势信息，是否前往？',
								success: function(res) {
									if (res.confirm) {
										uni.navigateTo({
											url: '/pages/send/lookFor/postgraduate/enrollment/advantage?backDelta=2'
										})
									}
								}
							});
						}
						if (res.data.educationState == 2) {
							return uni.showModal({
								title: '提示',
								content: '揭榜前需要完善您的个人学历详细简介，是否前往？',
								success: function(res) {
									if (res.confirm) {
										uni.navigateTo({
											url: '/pages/send/lookFor/postgraduate/enrollment/info?backDelta=1'
										})
									}
								}
							});
						}
						if (res.data.professionalState == 0) {
							return uni.showModal({
								title: '提示',
								content: '揭榜前需要完善您的职业信息，是否前往？',
								success: function(res) {
									if (res.confirm) {
										uni.navigateTo({
											url: '/settingPages/pages/job/job'
										})
									}
								}
							});
						}
						if (res.data.professionalState == 1) {
							return uni.showModal({
								title: '提示',
								content: '您的职业信息未通过审核，是否前往修改？',
								success: function(res) {
									if (res.confirm) {
										uni.navigateTo({
											url: '/settingPages/pages/job/job'
										})
									}
								}
							});
						}
						if (res.data.professionalState == 2) {
							return uni.showModal({
								title: '提示',
								content: '您的职业信息正在审核中，审核通过后才能揭榜哦~',
								success: function(res) {
									if (res.confirm) {
										// uni.navigateTo({
										// 	url:'/pages/send/lookFor/postgraduate/enrollment/education?backDelta=3'
										// })
									}
								}
							});
						}
						// 若信息完善，则调用揭榜接口
						answerFind({
							id: item.id
						}).then((res) => {
							if (res.code == 100000) {
								this.showSuccessTip = true
							}
						})
					}
				})
			},
			// 找人详情
			handleLookForItem(item) {
				uni.navigateTo({
					url: '/pages/send/lookFor/lookHomepage/lookHomepage?id=' + item.id
				})
			},
			layerOper(type) {
				if (type == 'cancel') {
					this.showSuccessTip = false
				} else {
					uni.navigateTo({
						url: '/pages/mine/queAndAnswer/queAndAnswer'
					})
				}
			},

			// 揭榜 status 是否是要找的人 false、不是， true、是 
			handleUnveiling(status) {
				uni.showModal({
					title: '提示',
					content: `是否确认${this.userInfo.nickName||'匿名用户'} ${status?'是':'不是'} 你要找的人`,
					success: (res) => {
						if (res.confirm) {
							console.log('父parentId', this.parentId);
							confirmUnveiled({
								id: this.findId,
								parentId: this.parentId,
								confirm: status,
							}).then(res => {
								if (res.code == 100000) {
									this.isUnveiling = false; //操作成功后，隐藏底部揭榜相关操作按钮
									// this.unveilingTxt = false;
									if (status) {
										this.tipPopup = true;
									} else {
										uni.showToast({
											title: '操作成功',
											icon: 'none'
										})
									}
									setTimeout(() => {
										this.handleKnow();
									}, 3000);
								}
							})
						} else if (res.cancel) {}
					}
				});

			},
			handleKnow() {
				this.tipPopup = false;
				setTimeout(() => {
					this.unveilingTxt = false;
				}, 1000)
			},

			// 找人/提问  type 1、提问，2、找人
			operClick(type) {
				if (type == 1) {
					return uni.navigateTo({
						url: `/pages/send/question/question?from=seniorSister&id=${this.userId}`
					})
				}
				if (type == 2) {
					// let item = {
					// 	seniorSisterId: this.userId,
					// 	seniorSisterName: this.userInfo.nickName,
					// 	seniorSisterAvatar: this.userInfo.avatar,
					// }
					// return uni.navigateTo({
					// 	url:`/pages/send/lookFor/publishPeople/publishPeople?type=1&items=${JSON.stringify(item)}`
					// })
					this.seniorSisterId = this.userId;
					this.seniorSisterName = this.userInfo.nickName;
					this.seniorSisterAvatar = this.userInfo.avatar;
					this.showEntrustPeople = true;
				}

			},

		},
		onPullDownRefresh() {
			this.getUser()
			this.getTabData()
			setTimeout(() => {
				uni.stopPullDownRefresh()
			}, 1000)
		},
		onReachBottom() {
			if (this.page < this.pageTotal) {
				++this.page
				if (this.activeTab == 0) {
					this.getQuesList()
				} else if (this.activeTab == 1) {
					this.getNoteList()
				} else if (this.activeTab == 2) {
					this.getGroupList()
				} else if (this.activeTab == 3) {
					this.getQQList()
				} else if (this.activeTab == 4) {
					this.getFindPeople()
				}
			} else {
				uni.showToast({
					title: '我也是有底线的',
					icon: 'none'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	// 自定义导航栏
	::v-deep .uni-navbar {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		z-index: 100;
	}

	::v-deep .uni-navbar__content {
		background-color: transparent !important;
		border: none;
	}

	::v-deep .uni-navbar__header {
		background-color: transparent !important;
	}

	.bg {
		height: 420rpx;
		overflow: hidden;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.homeMain {
		padding: 0 0 30rpx;
		box-sizing: border-box;
		background: rgba(255, 255, 255, .85);
		position: relative;
		margin: -122rpx 0 0;
		border-radius: 50rpx 50rpx;
		z-index: 2;

		.info {
			padding: 0 30rpx 0;
			margin: 0 0 40rpx;

			.avater {
				width: 180rpx;
				height: 180rpx;
				border-radius: 50%;
				margin: -60rpx 20rpx 0 0;
				box-sizing: border-box;
				box-shadow: 0 1px 15rpx rgba(0, 0, 0, .3);
				position: relative;
				text-align: center;

				.avaterImg {
					width: 100%;
					height: 100%;
					border-radius: 50%;
				}


				.playItem {
					width: 100%;
					box-shadow: 12rpx 12rpx 12rpx #ccc;
					height: 40rpx;
					background: #fff;
					border-radius: 40rpx;
					position: absolute;
					top: 140rpx;

					.waveGif {
						width: 120rpx;
						height: 30rpx;
						position: absolute;
						top: -36rpx;
						right: 10rpx;
					}
				}

				.videoUrls {
					position: absolute;
					border-radius: 40rpx;
					top: 140rpx;
					right: 0px;
					width: 60rpx;
					height: 60rpx;
					// margin-right: 10rpx;
				}
			}

			.fan {
				margin: 60rpx 0 0;

				&>view {
					margin-right: 18rpx;

					&>text {
						margin-right: 10rpx;
					}
				}
			}

			.intro {
				margin: 30rpx 0;
			}

			.edu,
			.job {
				margin: 0 0 20rpx 0;

				.noWidthBtn {
					padding: 0 30rpx;
				}

				.info-btn {
					height: 52rpx;
					line-height: 52rpx;
				}
			}

			// 教育
			.education-list {
				line-height: 1em;
				margin-top: 24rpx;

				.item {
					margin-bottom: 32rpx;
				}
			}

			// 职业
			.job-list {
				line-height: 1em;
				margin-top: 24rpx;

				.item {
					margin-bottom: 32rpx;
				}
			}


			.nickName {
				image {
					width: 40rpx;
					height: 40rpx;
					margin-left: 10rpx;
				}
			}
		}

		.tabModule {
			border-top: 20rpx solid $bordercolor;
			padding: 0 30rpx 30rpx;
			box-sizing: border-box;
		}

		.quesModule {
			.queOne {
				border-top: 20rpx solid $bordercolor;
			}

			.queOne:nth-child(1) {
				border-top: 2rpx solid $bordercolor;
			}
		}


		.btns {
			width: 100%;
			justify-content: center;
			position: fixed;
			bottom: 20rpx;
			z-index: 9;

			.btn1,
			.btn2 {
				width: 272rpx;
				height: 90rpx;
				border-radius: 44rpx;
				text-align: center;
				line-height: 90rpx;
				justify-content: center;

				view {
					justify-content: center;
					width: 32rpx;
					height: 32rpx;
					background-color: #fff;
					border-radius: 50%;
					margin-right: 10rpx;
				}

			}

			.btn1 {
				background: #72819A;
				border-top-right-radius: 0px;
				border-bottom-right-radius: 0px;

				view {
					margin-right: 20rpx;
				}
			}

			.btn2 {
				background: $colorMain;
				border-top-left-radius: 0px;
				border-bottom-left-radius: 0px;

				view {
					margin-left: 20rpx;
				}
			}
		}
	}

	.tipPopup {
		background: #363636;
		height: 248rpx;
		margin: 0 88rpx;
		border-radius: 40rpx;
		color: #ffffff;
		padding-top: 48rpx;

		.tips {
			margin-right: 70rpx;
		}

		image {
			// width: 96rpx;
			width: 190rpx;
			// height: 96rpx;
			border-radius: 50%;
			margin-left: 28rpx;
			margin-right: 20rpx;
		}

		.know-btn {
			width: 188rpx;
			height: 80rpx;
			background: $colorMain;
			border-radius: 100rpx;
			text-align: center;
			line-height: 80rpx;
			margin: auto;
			margin-top: 30rpx;
		}

	}

	.unveilingPopup {
		width: 364rpx;
		height: 300rpx;
		background: rgba(51, 51, 51, 0.8);

		margin: 0 88rpx;
		border-radius: 40rpx;
		color: #ffffff;
		padding-top: 48rpx;
		text-align: center;

		.tips {
			margin: 0 48rpx;
		}

		image {
			width: 124rpx;
			height: 124rpx;
			// margin-bottom: 14rpx;
		}
	}

	.groupList {
		padding: 0 30rpx;
		box-sizing: border-box;

		&>view {
			flex: 0 0 48%;
		}

		.groupOne {
			margin-bottom: 30rpx;
			border-radius: 8rpx;
		}
	}

	.groupItem {
		background: #fff;
		border-radius: 8rpx;
		position: relative;

		.groupBg {
			position: relative;
			border-radius: 8rpx 8rpx 0 0;

			.cover {
				overflow: hidden;

				&>image {
					width: 100%;
					height: 100%;
					display: block;
					border-radius: 8rpx 8rpx 0 0;
				}
			}

			.bgMain {
				border-radius: 8rpx 8rpx 0 0;
				position: absolute;
				height: 100%;
				width: 100%;
				top: 0;
				left: 0;
				background: rgba(0, 0, 0, .2);

				.oper {
					width: 100%;
					text-align: center;

					&>view {
						display: inline-block;
						background: rgba(0, 0, 0, .4);
						border-radius: 30rpx;
						padding: 6rpx 20rpx;
						margin: 0 10rpx;
					}
				}

				.qqNum {
					position: absolute;
					bottom: 0;
					left: 0;
					background: linear-gradient(to top, rgba(0, 0, 0, .5) 20%, rgba(0, 0, 0, 0));
					color: #fff;
					text-align: center;
					width: 100%;
					padding: 10rpx 0;

					text {
						display: inline-block;
						vertical-align: middle;
					}

					image {
						width: 50rpx;
						height: 50rpx;
						display: inline-block;
						vertical-align: middle;
					}
				}
			}

			.smallOper {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				padding: 0 10rpx;
				box-sizing: border-box;
				overflow: hidden;

				image {
					width: 50rpx;
					height: 50rpx;
				}
			}
		}

		.con {
			padding: 20rpx;
			box-sizing: border-box;
			border-radius: 0 0 8rpx 8rpx;
			border: 1px solid $bordercolor;

			.tag {
				margin: 10rpx 0;

				&>text {
					display: inline-block;
					margin: 0 10rpx 0 0;
				}
			}
		}
	}


	.lookForBox {
		margin: 0 30rpx;
		padding-top: 4rpx;
	}

	.peopleOne {
		// padding: 0 0 30rpx;
		// margin: 0 50rpx;
		// margin: 32rpx 30rpx 0 30rpx;
		// padding-top: 32rpx;
		box-sizing: border-box;
		background: #fff;
		position: relative;
		// margin:60rpx 0 0;头像往上跑的关联样式
		// margin:30rpx 0 0;
		// border-radius: 20rpx;
		border-radius: 0 0 24rpx 24rpx;
		z-index: 2;
		// box-shadow: 6rpx 6rpx 6rpx #ccc;
		margin-bottom: 20rpx;

		.info {
			// padding: 0 30rpx 0; // 头像会往上跑的关联样式
			// padding: 30rpx 30rpx 0;
			margin: 0;
			padding: 0;
			padding-bottom: 28rpx;

			// .avater{
			// width: 112rpx;
			// height: 112rpx;
			// border-radius: 50%;
			// margin:-60rpx 20rpx 0 0; //头像会往上超出一部分的样式
			// margin:0 20rpx 0 0;
			// box-sizing: border-box;
			// box-shadow: 0 1px 15rpx rgba(0,0,0,.3);
			image {
				width: 112rpx;
				height: 112rpx;
				border-radius: 50%;
				box-sizing: border-box;
				margin-right: 16rpx;
			}

			.foundPersonType {
				padding: 6rpx 0;
				// background: linear-gradient(to bottom, #EFEFEF, #E6E6E6);
				// border-radius: 4rpx;
				// color: #999;
			}

			// }
			.intro {
				// margin:30rpx 0;
			}

			.infoName {
				flex: 1;
			}

			.editBox {
				flex-shrink: 0;
				border: 1px solid #FFCC66;
				border-radius: 100rpx;
				border-top-left-radius: 0;
				border-top-right-radius: 0;

				.noWidthBtn {
					background: #f2f2f2;
					margin-left: 20rpx;
				}

				image {
					width: 50rpx;
					height: 50rpx;
					margin-left: 10rpx;
				}
			}

			.colorRed {
				width: 74rpx;
				height: 42rpx;
				border-radius: 100rpx;
				border-top-left-radius: 0;
				border-top-right-radius: 0;
				flex-shrink: 0;
				background: #FF7D5D;
				color: #fff;
				padding: 0 10rpx 0 10rpx;
				text-align: center;
			}

			.findTitle {
				margin: 20rpx 0;
				line-height: 32rpx;
			}

			.tag {
				line-height: 1em;
				color: #73839A;

				&>text {
					margin: 0 20rpx 0 0;
				}
			}

			.operBtn {
				margin: 32rpx 0 0;
				// .noWidthBtn{
				// 	margin-right: 20rpx;
				// }
			}

			.noClickBtn {
				.noWidthBtn {
					background: $colorMainOper;
				}
			}

			.otherBtn {

				// .noWidthBtn{
				// 	width:140rpx;
				// 	padding:8rpx 0;
				// 	text-align: center;
				// 	box-sizing: border-box;
				// }
				// .noWidthBtn:nth-child(1){
				// 	background: $colorblue;
				// }
				.leftBtn,
				.rightBtn {
					width: 140rpx;
					height: 60rpx;
					text-align: center;
					border: 1px solid #333333;
					border-radius: 44rpx;
					line-height: 1em;
					justify-content: center;

					image {
						width: 28rpx;
						height: 28rpx;
						margin-right: 6rpx
					}
				}

				.leftBtn {
					margin-right: 40rpx;
				}
			}
		}

		.tabModule {
			padding: 0 30rpx 0;
			box-sizing: border-box;
			margin: 0 0 30rpx;
		}

		.quesModule {
			.queOne {
				border-top: 20rpx solid $bordercolor;
			}
		}
	}

	.findBtn {
		position: fixed;
		right: 30rpx;
		bottom: 148rpx;
		z-index: 9;

		>view {
			width: 112rpx;
			height: 112rpx;
			background: rgba(102, 102, 102, .66);
			border-radius: 50%;
			text-align: center;
			color: #fff;
			margin: 0 auto;
			margin-top: 28rpx;
		}

		image {
			width: 48rpx;
			height: 48rpx;
			display: block;
			margin: 0 auto;
			padding-top: 12rpx;
		}
	}


	.hasVideo {
		width: 600rpx;

		video {
			height: 400rpx;
			width: 100%;
			display: block;
			// margin: 100rpx auto 0;
		}
	}
</style>